<template>
  <div class="or-container">
              <div class="box" :class="eleindex ==i?'eleactive':''" v-for="(ele,i) in piclist" :key="i" @mouseenter="enter(i)" @mouseleave="out(i)">
                <img :src="ele.img">
                <span>{{i}}</span>
              </div>
</template>

<script>
export default {
    data () {
      return {
        eleindex: 0,
        piclist: [
        //   {text: '播放/录制页面', bg: require('../../static/assets/images/home-pic/home-pic1.jpg'), img: ''},
        //   {text: '播放/录制页面', bg: require('../../static/assets/images/home-pic/home-pic1.jpg'), img: '../../static/assets/images/home-pic/home-pic1.jpg'},
        //   {text: '播放/录制页面', bg: require('../../static/assets/images/home-pic/home-pic1.jpg'), img: '../../static/assets/images/home-pic/home-pic1.jpg'},
        //   {text: '播放/录制页面', bg: require('../../static/assets/images/home-pic/home-pic1.jpg'), img: '../../static/assets/images/home-pic/home-pic1.jpg'},
        //   {text: '播放/录制页面', bg: require('../../static/assets/images/home-pic/home-pic1.jpg'), img: '../../static/assets/images/home-pic/home-pic1.jpg'}

        ]
      }
    },
    methods:{
        enter: function (i) {
        console.log(i)
        this.eleindex = i
        // if (this.eleindex === i) {
        //   this.eleindex = -1
        // } else {
        //   this.eleindex = i
        // }
      },
      out: function (i) {
        this.imgindex = -1
      }
    }

}
</script>

<style scoped>
.or-container {
  display: flex;
  width: 100%;
  padding: 4% 2%;
  box-sizing: border-box;
  height: 48vh;
}
.or-container:before {
  background-color: rgba(0,0,0,0.4);
}

.box {
  flex: 1;
  overflow: hidden;
  transition: .5s;
  box-shadow: 0 20px 30px rgba(0, 0, 0, 0.1);
  line-height: 0;
}

.box > img {
  width: 100%;
  height: calc(100% - 10vh);
  -o-object-fit: cover;
  object-fit: cover;
  transition: .5s;
}

.box > span {
  font-size: 3.8vh;
  display: block;
  text-align: center;
  height: 10vh;
  line-height: 2.6;
}

.eleactive {
  flex: 1 1 15%;
}

.eleactive > img {
  width: 100%;
  height: 100%;
}

</style>